//---------------------------------------------------------------------------

#ifndef uDiversH
#define uDiversH
//---------------------------------------------------------------------------
#include <math.h>
#include <db.hpp>
#include "uEtat.h"

class EICFont;
class EICNumberFmt;
class EICCurrencyFmt;

#define FILE_VERSION( h, b)    MAKELONG( b, h)

enum NumException {
    Exc_Fichier_Abime,
    Exc_Ecriture_impossible,
    Exc_Version_posterieure
};

class ETATAPI EDocException : public Exception
{
private:
    int m_nNumException;
public :
    __fastcall EDocException( int nNumException);

    __property int NumMessage = { read = m_nNumException};
};
//---------------------------------------------------------------------------
void ChargeImage( TPicture **Picture, TStream *Stream);
//---------------------------------------------------------------------------
class ETATAPI TFlux : public TObject
{
private :
    TStream *m_s;
    DWORD m_FileVersion;
    int  __fastcall Read(void *Buffer, int Count){return m_s->Read(Buffer, Count);};
    int  __fastcall Write(const void *Buffer, int Count){return m_s->Write(Buffer, Count);};
    int  __fastcall GetSize(){return m_s->Size;};
    int  __fastcall GetPosition(){return m_s->Position;};
    void __fastcall SetPosition(int Pos){ m_s->Position = Pos;};


public :
#define Font_fsBold       0x01
#define Font_fsItalic     0x02
#define Font_fsUnderline  0x04
#define Font_fsStrikeOut  0x08
    __fastcall TFlux( const AnsiString &FileName, Word Mode);
    __fastcall TFlux( );
    virtual __fastcall ~TFlux( );

    __property DWORD FileVersion = {read=m_FileVersion, write=m_FileVersion};
    __property int Size = {read=GetSize};
    __property int Position = {read=GetPosition,write=SetPosition};
    __property TStream *s={read=m_s};


    void __fastcall Lit( char  &c);
    void __fastcall Lit( byte  &b);
    void __fastcall Lit( bool  &b);
    void __fastcall Lit( WORD  &w);
    void __fastcall Lit( int   &i);
    void __fastcall Lit( float &f);
    void __fastcall Lit( double &d);
    void __fastcall Lit( DWORD &d);
    void __fastcall Lit( short &s);
    void __fastcall Lit( AnsiString &s);
    void __fastcall Lit( TColor &c);
    void __fastcall Lit( TPenStyle &ps);
    void __fastcall Lit( TBrushStyle &bs);
    void __fastcall Lit( EICFont **ppFont);
    void __fastcall Lit( EICCurrencyFmt **pCurrencyFormat);
    void __fastcall Lit( EICNumberFmt **ppNumberFormat);
    void __fastcall Lit( TStringList *Lst);
    void __fastcall Lit( TParams** pParams);
    void __fastcall Lit( TPicture** pPicture);

    void __fastcall Ecrit( char  c);
    void __fastcall Ecrit( byte  b);
    void __fastcall Ecrit( bool  b);
    void __fastcall Ecrit( WORD  w);
    void __fastcall Ecrit( int   i);
    void __fastcall Ecrit( float f);
    void __fastcall Ecrit( double d);
    void __fastcall Ecrit( DWORD d);
    void __fastcall Ecrit( short s);
    void __fastcall Ecrit( const AnsiString &s);
    void __fastcall Ecrit( const TColor col, const TColor colDef);
    void __fastcall Ecrit( const TPenStyle ps);
    void __fastcall Ecrit( const TBrushStyle ps);
    void __fastcall Ecrit( EICFont *pFont, EICFont *FontDefaut=NULL); /* Pas en const faute de compatibilité du TFont */
    void __fastcall Ecrit( const EICCurrencyFmt *CurrencyFormat, const EICCurrencyFmt *pCurrencyFormatDefault=NULL);
    void __fastcall Ecrit( const EICNumberFmt *NumberFormat, const EICNumberFmt *pNumberFormatDefault=NULL);
    void __fastcall Ecrit( TStringList* Lst);
    void __fastcall Ecrit( TParams* Params);
    void __fastcall Ecrit( TPicture* pPicture);
};
TFlux* ETATAPI __fastcall NewTFlux( void);
void   ETATAPI __fastcall DeleteTFlux(TFlux* Flux);

//---------------------------------------------------------------------------


#define MM_PER_INCH     25.4
#define PixelsEcran PixelsR[Glob->ResolEcran]

#define DixMm2PixelsX(i) DixMm2Pixels( i, Glob->ResolutionX)
#define Pixels2DixMmX(i) Pixels2DixMm( i, Glob->ResolutionX)
#define Pixels2TwipsX(i) Pixels2Twips( i, Glob->ResolutionX)
#define Twips2PixelsX(i) Twips2Pixels( i, Glob->ResolutionX)
#define PixX(i)          Pix( i, Glob->ResolutionX)
#define DixMm2PixelsY(i) DixMm2Pixels( i, Glob->ResolutionY)
#define Pixels2DixMmY(i) Pixels2DixMm( i, Glob->ResolutionY)
#define Pixels2TwipsY(i) Pixels2Twips( i, Glob->ResolutionY)
#define Twips2PixelsY(i) Twips2Pixels( i, Glob->ResolutionY)
#define PixY(i)          Pix( i, Glob->ResolutionY)

class ETATAPI TCoordonnee
{
    private :
        double m_Twips;      // en 1440ème de pouce

        int    GetPixelsR( double Resolution)const    { return Twips2Pixels( m_Twips, Resolution); };
        void   PutPixelsR( double Resolution, int n)  { m_Twips = Pixels2Twips( n, Resolution);    };

        int    GetPixelsX( )const   { return Twips2Pixels( m_Twips, Glob->ResolutionX);   };
        void   PutPixelsX( int n)   { m_Twips = Pixels2Twips( n, Glob->ResolutionX);      };
        int    GetPixelsY( )const   { return Twips2Pixels( m_Twips, Glob->ResolutionY);   };
        void   PutPixelsY( int n)   { m_Twips = Pixels2Twips( n, Glob->ResolutionY);      };

        int    GetDixMm( )const   { return Twips2DixMm( m_Twips);   };
        void   PutDixMm( int n)   { m_Twips = DixMm2Twips( n);      };

        double GetMm( )const      { return /*::MulDiv*/(m_Twips * MM_PER_INCH / 1440);   };
        void   PutMm( double n)   { m_Twips = n * 1440. / MM_PER_INCH;     };

        double GetPouces( )const   { return /*::MulDiv*/(m_Twips* 1/ 1440);   };
        void   PutPouces( double n){ m_Twips = ::MulDiv( n, 1440, 1);     };
    public  :
        __fastcall TCoordonnee( double n = 0){ m_Twips = n;};
        void __fastcall Lit( TFlux *f);
        void __fastcall Enregistre( TFlux *f)const;


        __property double  Twips       = { read = m_Twips,     write = m_Twips};

        __property int     PixelsR[double Resolution]      = { read = GetPixelsR,   write = PutPixelsR};
        __property int     PixelsX     = { read = GetPixelsX,  write = PutPixelsX};
        __property int     PixelsY     = { read = GetPixelsY,  write = PutPixelsY};
        __property double  Mm          = { read = GetMm,       write = PutMm};
        __property int     DixMm       = { read = GetDixMm,    write = PutDixMm};
        __property double  Pouces      = { read = GetPouces,   write = PutPouces};

//        TCoordonnee&  __fastcall AddPixels(int n) { m_Twips += Pixels2Twips( n); return *this; };
        TCoordonnee&  __fastcall AddDixMm(int n)  { m_Twips += DixMm2Twips( n);  return *this; };
        bool  __fastcall IsNegatif()const         {return( m_Twips < 0.);};
        bool  __fastcall IsNull()const            {return( m_Twips == 0.);};

        bool         __fastcall operator  !( )const { return m_Twips == 0.;    };
        TCoordonnee  __fastcall operator  +(const TCoordonnee &c)const { TCoordonnee c1( *this); c1.m_Twips += c.m_Twips; return c1;    };
        TCoordonnee  __fastcall operator  -(const TCoordonnee &c)const { TCoordonnee c1( *this); c1.m_Twips -= c.m_Twips; return c1;    };
        TCoordonnee  __fastcall operator  -()                    const { TCoordonnee c1;         c1.m_Twips  = -m_Twips;  return c1;    };
        TCoordonnee  __fastcall operator  /(      double       n)const { TCoordonnee c1( *this); c1.m_Twips /= n;         return c1;    };
        TCoordonnee  __fastcall operator  *(      double       n)const { TCoordonnee c1( *this); c1.m_Twips *= n;         return c1;    };
        TCoordonnee& __fastcall operator +=(const TCoordonnee &c)      { m_Twips += c.m_Twips; return (*this);};
        TCoordonnee& __fastcall operator -=(const TCoordonnee &c)      { m_Twips -= c.m_Twips; return (*this);};
        TCoordonnee& __fastcall operator ++()                          { m_Twips++; return (*this);};
        TCoordonnee& __fastcall operator --()                          { m_Twips--; return (*this);};

//        TCoordonnee& __fastcall operator +=(const TCoordonnee &c)      {m_Twips += c.m_Twips;   return (*this); };
//        TCoordonnee& __fastcall operator -=(const TCoordonnee &c)      {m_Twips -= c.m_Twips;   return (*this); };

        bool         __fastcall operator ==(const TCoordonnee &c)const { return (m_Twips == c.Twips); };
        bool         __fastcall operator !=(const TCoordonnee &c)const { return (m_Twips != c.Twips); };
        bool         __fastcall operator < (const TCoordonnee &c)const { return (m_Twips <  c.Twips); };
        bool         __fastcall operator <=(const TCoordonnee &c)const { return (m_Twips <= c.Twips); };
        bool         __fastcall operator > (const TCoordonnee &c)const { return (m_Twips >  c.Twips); };
        bool         __fastcall operator >=(const TCoordonnee &c)const { return (m_Twips >= c.Twips); };

// Inutile, ce sont les fonctions template de EIC.h qui seront utilisées
//        static inline TCoordonnee min( const TCoordonnee &x, const TCoordonnee &y) { return( (x<y)? x:y); };
//        static inline TCoordonnee max( const TCoordonnee &x, const TCoordonnee &y) { return( (x>y)? x:y); };
        static        int         DixMm2Pixels( int i, double Res/* = Glob->Resolution*/)    { return i* Res / (MM_PER_INCH * 10);           };
        static        int         Pixels2DixMm( int i, double Res/* = Glob->Resolution*/)    { return i* MM_PER_INCH * 10 / Res;             };
        static        double      DixMm2Twips( double i)                                     { return i * 1440. / (double)(MM_PER_INCH*10);  };
        static        double      Pixels2Twips( int i, double Res/* = Glob->Resolution*/)    { return (double)i * 1440. / Res;               };
        static        int         Twips2DixMm( double i)                                     { return Round(i * MM_PER_INCH*10. / 1440, 0);  };
        static        int         Twips2Pixels( double i, double Res/* = Glob->Resolution*/) { return floor(i * Res /1440);  };
        static        TCoordonnee Pix( int Pixels, double Res/* = Glob->Resolution*/)        { TCoordonnee c; c.PixelsR[Res] = Pixels; return c;};
};
//---------------------------------------------------------------------------
class TCoorPoint
{
    private :
        TCoordonnee m_X;
        TCoordonnee m_Y;

        TPoint __fastcall GetPointTwips( )const      { TPoint pt; pt.x      = m_X.Twips; pt.y      = m_Y.Twips;  return pt;};
        void   __fastcall PutPointTwips( const TPoint &pt)  {     m_X.Twips = pt.x;      m_Y.Twips = pt.y; };

        TPoint __fastcall GetPointPixels( )const     { TPoint pt; pt.x        = m_X.PixelsX; pt.y        = m_Y.PixelsY;  return pt;};
        void   __fastcall PutPointPixels( const TPoint &pt) {            m_X.PixelsX = pt.x;        m_Y.PixelsY = pt.y; };

        TPoint __fastcall GetPointDixMm( )const     { TPoint pt; pt.x      = m_X.DixMm; pt.y      = m_Y.DixMm;  return pt;};
        void   __fastcall PutPointDixMm( const TPoint &pt) {     m_X.DixMm = pt.x;      m_Y.DixMm = pt.y; };

    public  :
        __fastcall TCoorPoint( ){};
        __fastcall TCoorPoint( const TCoordonnee &x, const TCoordonnee &y){m_X=x; m_Y=y;};
        void __fastcall Lit( TFlux *f);
        void __fastcall Enregistre( TFlux *f)const;


        void __fastcall SetPointPixels( int X, int Y) { m_X.PixelsX = X; m_Y.PixelsY = Y; };
        void __fastcall SetPointDixMm( int X, int Y)  { m_X.DixMm  = X; m_Y.DixMm  = Y; };

        __property TPoint      PointTwips  = { read = GetPointTwips,  write = PutPointTwips};
        __property TPoint      PointPixels = { read = GetPointPixels, write = PutPointPixels};
        __property TPoint      PointDixMm  = { read = GetPointDixMm,  write = PutPointDixMm};
        __property TCoordonnee x           = { read = m_X,        write = m_X};
        __property TCoordonnee y           = { read = m_Y,         write = m_Y};

        bool __fastcall operator ==(const TCoorPoint &pt) const {return ((m_X == pt.m_X) && (m_Y == pt.m_Y));};
        bool __fastcall operator !=(const TCoorPoint &pt) const {return !(*this == pt);};
};

//---------------------------------------------------------------------------
class TCoorRect
{
    private :
        TCoordonnee m_Left;
        TCoordonnee m_Top;
        TCoordonnee m_Right;
        TCoordonnee m_Bottom;

        TRect __fastcall GetRectTwips( )const    { TRect rc; rc.Left        = m_Left.Twips;  rc.Top       = m_Top.Twips;  rc.Right       = m_Right.Twips;  rc.Bottom       = m_Bottom.Twips;  return rc;};
        void  __fastcall PutRectTwips( const TRect &rc) {           m_Left.Twips   = rc.Left;       m_Top.Twips  = rc.Top;       m_Right.Twips  = rc.Right;       m_Bottom.Twips  = rc.Bottom; };
        TRect __fastcall GetRectPixels( )const    { TRect rc; rc.Left        = m_Left.PixelsX; rc.Top        = m_Top.PixelsY; rc.Right        = m_Right.PixelsX; rc.Bottom        = m_Bottom.PixelsY; return rc;};
        void  __fastcall PutRectPixels( const TRect &rc) {           m_Left.PixelsX = rc.Left;        m_Top.PixelsY = rc.Top;        m_Right.PixelsX = rc.Right;        m_Bottom.PixelsY = rc.Bottom; };
        TRect __fastcall GetRectDixMm( )const     { TRect rc; rc.Left       = m_Left.DixMm;  rc.Top       = m_Top.DixMm;  rc.Right       = m_Right.DixMm;  rc.Bottom       = m_Bottom.DixMm;  return rc;};
        void  __fastcall PutRectDixMm( const TRect &rc) {     m_Left.DixMm  = rc.Left;       m_Top.DixMm  = rc.Top;       m_Right.DixMm  = rc.Right;       m_Bottom.DixMm  = rc.Bottom; };

        RECT __fastcall GetRECTTwips( )const    { RECT rc; rc.left       = m_Left.Twips;  rc.top       = m_Top.Twips;  rc.right       = m_Right.Twips;  rc.bottom       = m_Bottom.Twips;  return rc;};
        void __fastcall PutRECTTwips( const RECT &rc)  {          m_Left.Twips  = rc.left;       m_Top.Twips  = rc.top;       m_Right.Twips  = rc.right;       m_Bottom.Twips  = rc.bottom; };
        RECT __fastcall GetRECTPixels( )const   { RECT rc; rc.left        = m_Left.PixelsX; rc.top        = m_Top.PixelsY; rc.right        = m_Right.PixelsX; rc.bottom       = m_Bottom.PixelsY; return rc;};
        void __fastcall PutRECTPixels( const RECT &rc) {          m_Left.PixelsX = rc.left;        m_Top.PixelsY = rc.top;        m_Right.PixelsX = rc.right;        m_Bottom.PixelsY = rc.bottom; };
        RECT __fastcall GetRECTDixMm( )const    { RECT rc; rc.left       = m_Left.DixMm;  rc.top       = m_Top.DixMm;  rc.right       = m_Right.DixMm;  rc.bottom       = m_Bottom.DixMm;  return rc;};
        void __fastcall PutRECTDixMm( const RECT &rc) {    m_Left.DixMm  = rc.left;       m_Top.DixMm  = rc.top;       m_Right.DixMm  = rc.right;       m_Bottom.DixMm  = rc.bottom; };

        TCoordonnee __fastcall GetWidth()const  { return m_Right  - m_Left;};
        TCoordonnee __fastcall GetHeight()const { return m_Bottom - m_Top;};
        TCoorPoint  __fastcall GetTopLeft()const{ return TCoorPoint( m_Left, m_Top);};
        void        __fastcall SetTopLeft(const TCoorPoint &pt){ m_Left = pt.x; m_Top = pt.y; };
        TCoorPoint  __fastcall GetBottomRight()const{ return TCoorPoint( m_Right, m_Bottom);};
        void        __fastcall SetBottomRight(const TCoorPoint &pt){ m_Right = pt.x; m_Bottom = pt.y; };

    public  :
        __fastcall TCoorRect( ){};
        __fastcall TCoorRect( const TCoordonnee &l, const TCoordonnee &t,const TCoordonnee &r, const TCoordonnee &b){m_Left=l;m_Top=t;m_Right=r;m_Bottom=b;};
        void __fastcall Lit( TFlux *f);
        void __fastcall Enregistre( TFlux *f)const;

        void __fastcall SetRectPixels( int Left, int Top, int Right, int Bottom) { m_Left.PixelsX = Left;       m_Top.PixelsY = Top;       m_Right.PixelsX = Right;       m_Bottom.PixelsY = Bottom; };
        void __fastcall SetRectDixMm( int Left, int Top, int Right, int Bottom)  { m_Left.DixMm   = Left;       m_Top.DixMm   = Top;       m_Right.DixMm   = Right;       m_Bottom.DixMm   = Bottom; };

        __property TRect       RectPixels = { read = GetRectPixels, write = PutRectPixels};
        __property TRect       RectDixMm  = { read = GetRectDixMm,  write = PutRectDixMm};
        __property TRect       RectTwips  = { read = GetRectTwips,  write = PutRectTwips };
        __property RECT        RECTPixels = { read = GetRECTPixels, write = PutRECTPixels};
        __property RECT        RECTDixMm  = { read = GetRECTDixMm,  write = PutRECTDixMm};
        __property RECT        RECTTwips  = { read = GetRECTTwips,  write = PutRECTTwips };
        __property TCoordonnee Left       = { read = m_Left,        write = m_Left};
        __property TCoordonnee Top        = { read = m_Top,         write = m_Top};
        __property TCoordonnee Right      = { read = m_Right,       write = m_Right};
        __property TCoordonnee Bottom     = { read = m_Bottom,      write = m_Bottom};
        __property TCoordonnee Width      = { read = GetWidth};
        __property TCoordonnee Height     = { read = GetHeight};
        __property TCoorPoint  TopLeft    = { read = GetTopLeft,    write = SetTopLeft};
        __property TCoorPoint  BottomRight= { read = GetBottomRight,write = SetBottomRight};

        bool __fastcall operator ==(const TCoorRect &rc) const {return ((m_Left == rc.m_Left) && (m_Top == rc.m_Top) && (m_Right == rc.m_Right) && (m_Bottom == rc.m_Bottom));};
        bool __fastcall operator !=(const TCoorRect &rc) const {return !(*this == rc);};
};

//---------------------------------------------------------------------------

class ETATAPI EICAnsiString : public TObject
{
    private :
        AnsiString m_Text;
    public  :
        __fastcall EICAnsiString( const AnsiString &s):TObject(){m_Text=s;};
        __fastcall EICAnsiString( const char* s):TObject(){m_Text=s;};
        __fastcall EICAnsiString( ):TObject(){};
        AnsiString& __fastcall operator= ( const AnsiString &s)    { m_Text = s; return m_Text;};
        bool        __fastcall operator==( const AnsiString &s)const { return s == m_Text;};
        char        __fastcall operator[]( int i)const             { return m_Text[i];};
        AnsiString* __fastcall operator->()                        { return &m_Text;};
        __property AnsiString Text = {read=m_Text,write=m_Text};

};

//---------------------------------------------------------------------------

class ETATAPI EICFont : public TFont
{  /* Pas de const faute de compatibilité du TFont */
protected :
	TFontStyles __fastcall GetStyle(void)const      {return TFont::GetStyle();};
	AnsiString __fastcall GetName()const            {return TFont::GetName();};
	int __fastcall GetSize(void)const               {return TFont::GetSize();};
	int __fastcall GetHeight(void)const             {return TFont::GetHeight();};
	TFontCharset __fastcall GetCharset(void)const   {return TFont::GetCharset();};
	TFontPitch __fastcall GetPitch(void)const       {return TFont::GetPitch();};
	HFONT __fastcall GetHandle(void)const           {return TFont::GetHandle();};
__published:
	__property TFontCharset Charset = {read=GetCharset, write=SetCharset, nodefault};
	__property int Height = {read=GetHeight, write=SetHeight, nodefault};
	__property AnsiString Name = {read=GetName, write=SetName};
	__property TFontPitch Pitch = {read=GetPitch, write=SetPitch, default=0};
	__property int Size = {read=GetSize, write=SetSize, stored=false, nodefault};
private :
    const TFontStyles __fastcall EICGetStyle()const { return ( GetStyle());}
//	inline void __fastcall EICSetStyle(TFontStyles Value){  TFont::Style = Value;  };

public:
    static EICFont* CreateEICFont( TFont* f);
  	__fastcall EICFont(void);
    __fastcall EICFont( TFlux *f);
    void __fastcall Enregistre( TFlux *f)const;


	__property HFONT Handle = {read=GetHandle, write=SetHandle, nodefault};
    __property TFontStyles Style = {read=EICGetStyle, write=SetStyle, nodefault};
    bool __fastcall operator == ( const EICFont &f)const {
                    return(
                      ( (Style.Contains( fsBold)       && f.Style.Contains( fsBold)      ) ||
                        (!Style.Contains( fsBold)      && !f.Style.Contains( fsBold)     )   ) &&
                      ( (Style.Contains( fsItalic)     && f.Style.Contains( fsItalic)    ) ||
                        (!Style.Contains( fsItalic)    && !f.Style.Contains( fsItalic)   )   ) &&
                      ( (Style.Contains( fsUnderline)  && f.Style.Contains( fsUnderline) ) ||
                        (!Style.Contains( fsUnderline) && !f.Style.Contains( fsUnderline))   ) &&
                      ( (Style.Contains( fsStrikeOut)  && f.Style.Contains( fsStrikeOut) ) ||
                        (!Style.Contains( fsStrikeOut) && !f.Style.Contains( fsStrikeOut))   ) &&
                      (Charset                      == f.Charset                     ) &&
                      (Color                        == f.Color                       ) &&
                      (Name                         == f.Name                        ) &&
                      (Pitch                        == f.Pitch                       ) &&
                      (Height                       == f.Height                      ) &&
                      (Size                         == f.Size                        )    ); };
    bool __fastcall operator != ( const EICFont &f)const { return( !(*this == f)); };
    EICFont& __fastcall operator = ( const EICFont &f) { if (*this != f){
                                                    Style     = f.Style;
                                                    Charset   = f.Charset;
                                                    Color     = f.Color;
                                                    Name      = f.Name;
                                                    Pitch     = f.Pitch;
                                                    Height    = f.Height;
                                                    Size      = f.Size; }
                                                         return *this; };
};

//---------------------------------------------------------------------------
enum eSignePositif { sp_Aucun, sp_Gauche};
class ETATAPI EICNumberFmt : public TObject
{
    private:
      static char sDecimalSep[2];
    protected:
        UINT          m_NumDigits;
        UINT          m_LeadingZero;
        UINT          m_Grouping;
        AnsiString    m_DecimalSep;
        AnsiString    m_ThousandSep;
        UINT          m_NegativeOrder;
        bool          m_ZeroSignificatif;
        bool          m_DecimaleZeroSignificatif;
        USHORT        m_NbUniteArrondies;
        eSignePositif m_SignePositif;
        NUMBERFMT* __fastcall GetNumberFmt()const;

        void __fastcall SetNumDigits(UINT u);
        void __fastcall SetLeadingZero(UINT u);
        void __fastcall SetGrouping(UINT u);
        void __fastcall SetNegativeOrder(UINT u);
        AnsiString __fastcall Arrondi( const AnsiString &s, bool &bPositif)const;
        AnsiString& __fastcall FormatageFinal( AnsiString &s, bool bPositif)const;

    public:
    	__fastcall EICNumberFmt(const NUMBERFMT *NumFmt);
    	__fastcall EICNumberFmt();
        __fastcall EICNumberFmt( TFlux *f);
        void __fastcall Enregistre( TFlux *f)const;


        bool __fastcall operator == ( const EICNumberFmt &c)const;
        bool __fastcall operator != ( const EICNumberFmt &c)const;

        __property NUMBERFMT*    NumberFmt       = {read=GetNumberFmt};
        __property UINT          NumDigits       = {read=m_NumDigits,          write=SetNumDigits};
        __property UINT          LeadingZero     = {read=m_LeadingZero,        write=SetLeadingZero};
        __property UINT          Grouping        = {read=m_Grouping,           write=SetGrouping};
        __property AnsiString    DecimalSep      = {read=m_DecimalSep,         write=m_DecimalSep};
        __property AnsiString    ThousandSep     = {read=m_ThousandSep,        write=m_ThousandSep};
        __property UINT          NegativeOrder   = {read=m_NegativeOrder,      write=SetNegativeOrder};
        __property bool          ZeroSignificatif= {read=m_ZeroSignificatif,   write=m_ZeroSignificatif};
        __property bool          DecimaleZeroSignificatif = {read=m_DecimaleZeroSignificatif,   write=m_DecimaleZeroSignificatif};
        __property USHORT        NbUniteArrondies= {read=m_NbUniteArrondies,   write=m_NbUniteArrondies};
        __property eSignePositif SignePositif    = {read=m_SignePositif,       write=m_SignePositif};
        virtual AnsiString __fastcall Chaine( const AnsiString &s)const;
        void __fastcall Assign( const EICNumberFmt &n);
        void __fastcall Assign( const NUMBERFMT &n);
};
//---------------------------------------------------------------------------
class ETATAPI EICCurrencyFmt : public EICNumberFmt
{
    private:
        typedef EICNumberFmt inherited;
        UINT         m_PositiveOrder;
        AnsiString   m_CurrencySymbol;
        CURRENCYFMT* __fastcall GetCurrencyFmt()const;
        void __fastcall SetNegativeOrder(UINT u);
        void __fastcall SetPositiveOrder(UINT u);

    public:
    	__fastcall EICCurrencyFmt(const CURRENCYFMT *CurFmt);
    	__fastcall EICCurrencyFmt();
        __fastcall EICCurrencyFmt( TFlux *f, const AnsiString &CurSymbol = EmptyStr);
        void __fastcall Enregistre( TFlux *f)const;


        bool __fastcall operator == ( const EICCurrencyFmt &c)const;
        bool __fastcall operator != ( const EICCurrencyFmt &c)const;

        __property CURRENCYFMT* CurrencyFmt     = {read=GetCurrencyFmt};
        __property UINT         PositiveOrder   = {read=m_PositiveOrder,    write=SetPositiveOrder};
        __property AnsiString   CurrencySymbol  = {read=m_CurrencySymbol,   write=m_CurrencySymbol};
        __property UINT         NegativeOrder   = {read=m_NegativeOrder,    write=SetNegativeOrder};
        AnsiString __fastcall Chaine( const AnsiString &s)const;
        void __fastcall Assign( const EICCurrencyFmt &n);
        void __fastcall Assign( const CURRENCYFMT &n);
};

//---------------------------------------------------------------------------
#define Nocl            clNone
#define Nobs            (TBrushStyle)(bsDiagCross+1)
class ETATAPI EICStyle : public TObject
{
    private:
        AnsiString        m_Nom;
        bool              m_TailleFontModifiable;
        EICFont          *m_Font;
        TColor            m_BrushColor;
        bool              m_StyleFondModifiable;
        TBrushStyle       m_BrushStyle;
        Text_Presentation m_Presentation;
        bool              m_NomPoliceMofifiable;
        AnsiString        m_LstColorPerso;

        void SetNom( const AnsiString &s)                 { m_Nom = s;}
        void SetTailleFontModifiable( const bool b)       { m_TailleFontModifiable = b;}
        void SetFont( EICFont *p)                         { if( !p && m_Font) {delete m_Font; m_Font = NULL;} m_Font = p;}
        void SetBrushColor( const TColor c)               { m_BrushColor = c;}
        void SetStyleFondModifiable( const bool b)        { m_StyleFondModifiable = b;}
        void SetBrushStyle( const TBrushStyle bs)         { m_BrushStyle = bs;}
        void SetPresentation( const Text_Presentation ep) { m_Presentation = ep;}
        void SetNomPoliceModifiable( const bool b)        { m_NomPoliceMofifiable = b;}
        void SetLstColorPerso( const AnsiString &s)       { m_LstColorPerso = s;}

    public:
    	__fastcall EICStyle():TObject(){m_Nom = EmptyStr; m_TailleFontModifiable = false; m_Font = NULL; m_BrushColor = Nocl; m_StyleFondModifiable = false; m_BrushStyle = Nobs; m_Presentation = Tx_Aucun; m_NomPoliceMofifiable = false; m_LstColorPerso = EmptyStr;};
    	virtual __fastcall ~EICStyle();
      __fastcall EICStyle( TFlux *f);
      void __fastcall Enregistre( TFlux *f)const;
      __property AnsiString        Nom                  = {read=m_Nom,                 write=SetNom};
      __property bool              TailleFontModifiable = {read=m_TailleFontModifiable,write=SetTailleFontModifiable};
      __property EICFont          *Font                 = {read=m_Font,                write=SetFont};
      __property TColor            BrushColor           = {read=m_BrushColor,          write=SetBrushColor};
      __property bool              StyleFondModifiable  = {read=m_StyleFondModifiable, write=SetStyleFondModifiable};
      __property TBrushStyle       BrushStyle           = {read=m_BrushStyle,          write=SetBrushStyle};
      __property Text_Presentation Presentation         = {read=m_Presentation,        write=SetPresentation};
      __property bool              NomPoliceModifiable  = {read=m_NomPoliceMofifiable, write=SetNomPoliceModifiable};
      __property AnsiString        LstColorPerso        = {read=m_LstColorPerso,       write=SetLstColorPerso};
};
//---------------------------------------------------------------------------
class  ETATAPI EICListStyle : public TStringList
{
    private :
      void __fastcall ViderListe( void);
    public  :
    	virtual __fastcall ~EICListStyle();
      __fastcall EICListStyle( TFlux *f = NULL);
      void __fastcall Lit( TFlux *f);
      void __fastcall Enregistre( TFlux *f)const;
    #pragma warn -8022   //oui, je sais mais je m'en tape le cocotier, c'est la mienne que je veux.
      virtual void __fastcall Assign( const EICListStyle *pLstStyle);
    #pragma warn .8022
};
EICListStyle* ETATAPI NewEICListStyle(void);
void          ETATAPI DeleteEICListStyle(EICListStyle* Lst);


#endif
